cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)

include(${CMAKE_CURRENT_SOURCE_DIR}/../../../mkspecs/cmake/global.cmake)

set(SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/app-dos.cpp
    )
if(WIN32)
    list(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/app-dos.rc)
endif()

include_directories(
    ${CYG_INC_PATH}/mod1-shared-ab
    ${CYG_INC_PATH}/mod2-shared-ab
    )

link_libraries(
    debug mod1-shared-ab${CMAKE_DEBUG_POSTFIX} optimized mod1-shared-ab
    debug mod2-shared-ab${CMAKE_DEBUG_POSTFIX} optimized mod2-shared-ab
    )

add_executable(app-dos ${SOURCES})
set_target_properties(app-dos PROPERTIES
    OUTPUT_NAME                   "app-dos"
    DEBUG_OUTPUT_NAME             "app-dos${CMAKE_DEBUG_POSTFIX}"
    VS_DEBUGGER_WORKING_DIRECTORY ${CYG_LIB_PATH})
install(TARGETS app-dos DESTINATION ${INSTALL_RUN_PATH})

install(FILES     app-dos.json                      DESTINATION ${INSTALL_CONFIG_PATH})
if(WIN32)
    install(FILES app-dos${CMAKE_DEBUG_POSTFIX}.bat DESTINATION ${INSTALL_RUN_PATH})
else()
    install(FILES app-dos${CMAKE_DEBUG_POSTFIX}.sh  DESTINATION ${INSTALL_RUN_PATH})
endif()
